# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name： get_delete
Description :
Author : 'li'
date： 2022/3/26
-------------------------------------------------
Change Activity:
2022/3/26:
-------------------------------------------------
"""
import os
import shutil

from ml import list_file_paths_in_dir, create_dir, join_path

TO_COPY_DIR = rf'C:\Users\marje\Desktop\2022年6月6日\res\mask_img'
NOT_DELETE_DIR = rf'C:\Users\marje\Desktop\2022年6月6日\res\mask_img'
DELETE_DIR = rf'C:\Users\marje\Desktop\2022年6月6日\res\vis_classify_bbox'
DESTINATION_DIR = rf'C:\Users\marje\Desktop\2022年6月6日\res\left'

paths = list_file_paths_in_dir(NOT_DELETE_DIR)
not_delete_mapping = {}
for p in paths:
    _, name = os.path.split(p)
    not_delete_mapping[name] = p
paths = list_file_paths_in_dir(TO_COPY_DIR)
all_path_mapping = {}
for p in paths:
    _, name = os.path.split(p)
    all_path_mapping[name] = p

left = list_file_paths_in_dir(DELETE_DIR)
left_lst = []
for p in left:
    _, name = os.path.split(p)
    left_lst.append(name)
create_dir(DESTINATION_DIR)
for name in not_delete_mapping:
    if name not in left_lst:
        shutil.copy(all_path_mapping[name], join_path(DESTINATION_DIR, name))
